package cn.wolfcode.wolf2w.service.impl;

import cn.wolfcode.wolf2w.domain.Spot;
import cn.wolfcode.wolf2w.repository.SpotRepository;
import cn.wolfcode.wolf2w.service.ISpotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpotServiceImpl implements ISpotService {

	@Autowired
	private SpotRepository spotRepository;

	@Override
	public void save(Spot spot) {
		spotRepository.save(spot);
	}

	@Override
	public void update(Spot spot) {
		spotRepository.save(spot);
	}

	@Override
	public void delete(String id) {
		spotRepository.deleteById(id);
	}

	@Override
	public Spot get(String id) {
		return spotRepository.findById(id).orElse(null);
	}

	@Override
	public List<Spot> list() {
		return spotRepository.findAll();
	}

	@Override
	public Page<Spot> query() {
		return null;
	}
}
